package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TTransferLogMapper;
import com.ruoyi.system.domain.TTransferLog;
import com.ruoyi.system.service.ITTransferLogService;
import com.ruoyi.common.core.text.Convert;

/**
 * 寻访日志Service业务层处理
 * 
 * @author 杨一迪
 * @date 2024-12-29
 */
@Service
public class TTransferLogServiceImpl extends ServiceImpl<TTransferLogMapper,TTransferLog> implements ITTransferLogService

{
    @Autowired
    private TTransferLogMapper tTransferLogMapper;

    /**
     * 查询寻访日志
     * 
     * @param id 寻访日志主键
     * @return 寻访日志
     */
    @Override
    public TTransferLog selectTTransferLogById(Long id)
    {
        return tTransferLogMapper.selectTTransferLogById(id);
    }

    /**
     * 查询寻访日志列表
     * 
     * @param tTransferLog 寻访日志
     * @return 寻访日志
     */
    @Override
    public List<TTransferLog> selectTTransferLogList(TTransferLog tTransferLog)
    {
        return tTransferLogMapper.selectTTransferLogList(tTransferLog);
    }

    /**
     * 新增寻访日志
     * 
     * @param tTransferLog 寻访日志
     * @return 结果
     */
    @Override
    public int insertTTransferLog(TTransferLog tTransferLog)
    {
        tTransferLog.setCreateTime(DateUtils.getNowDate());
        return tTransferLogMapper.insertTTransferLog(tTransferLog);
    }

    /**
     * 修改寻访日志
     * 
     * @param tTransferLog 寻访日志
     * @return 结果
     */
    @Override
    public int updateTTransferLog(TTransferLog tTransferLog)
    {
        tTransferLog.setUpdateTime(DateUtils.getNowDate());
        return tTransferLogMapper.updateTTransferLog(tTransferLog);
    }

    /**
     * 批量删除寻访日志
     * 
     * @param ids 需要删除的寻访日志主键
     * @return 结果
     */
    @Override
    public int deleteTTransferLogByIds(String ids)
    {
        return tTransferLogMapper.deleteTTransferLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 批量软删除寻访日志
     *
     * @param ids 需要软删除的寻访日志主键
     * @return 结果
     */
    @Override
    public int softDeleteTTransferLogByIds(String ids)
    {
        String[] strArray = Convert.toStrArray(ids);
        int count = 0;
        for (String s : strArray) {
            TTransferLog tTransferLog = tTransferLogMapper.selectTTransferLogById(Long.valueOf(s));
            tTransferLog.setIsDelete(1);
            int i = tTransferLogMapper.updateTTransferLog(tTransferLog);
            count = count + i;
        }
        return count;
    }

    /**
     * 删除寻访日志信息
     * 
     * @param id 寻访日志主键
     * @return 结果
     */
    @Override
    public int deleteTTransferLogById(Long id)
    {
        return tTransferLogMapper.deleteTTransferLogById(id);
    }
}
